
package com.insigma.business.qrcode.common.converter;


import com.insigma.business.qrcode.merchant.dto.search.CareWelfareMerchantStreetRelBSearcher;
import com.insigma.business.qrcode.welfare.dto.CareWelfareMerchantStreetRelDTO;
import com.insigma.business.qrcode.merchant.entity.CareWelfareMerchantStreetRelDO;
import com.insigma.business.qrcode.merchant.dto.request.CareWelfareMerchantStreetRelInsertRequest;
import com.insigma.business.qrcode.merchant.dto.request.CareWelfareMerchantStreetRelSearchRequest;
import com.insigma.business.qrcode.merchant.dto.request.CareWelfareMerchantStreetRelUpdateRequest;
import org.springframework.beans.BeanUtils;

import java.util.List;


public class CareWelfareMerchantStreetRelProviderConverter extends AbstractConverter<CareWelfareMerchantStreetRelDTO, CareWelfareMerchantStreetRelDO> {

    private final static CareWelfareMerchantStreetRelProviderConverter careWelfareMerchantStreetRelConverter = new CareWelfareMerchantStreetRelProviderConverter();

    private CareWelfareMerchantStreetRelProviderConverter(){}

    
    public static CareWelfareMerchantStreetRelBSearcher convertRequestSO2Searcher(final CareWelfareMerchantStreetRelSearchRequest request){
        final CareWelfareMerchantStreetRelBSearcher careWelfareMerchantStreetRelBSearcher = new CareWelfareMerchantStreetRelBSearcher(request.getPageNo(),
        request.getPageSize(),request.getSortKeyValueJoint());
        BeanUtils.copyProperties(request,careWelfareMerchantStreetRelBSearcher);
        return careWelfareMerchantStreetRelBSearcher;
    }

    
    public static CareWelfareMerchantStreetRelDO convertRequestUO2DO(final CareWelfareMerchantStreetRelUpdateRequest careWelfareMerchantStreetRelUpdateRequest) {
        final CareWelfareMerchantStreetRelDO careWelfareMerchantStreetRelDO = new CareWelfareMerchantStreetRelDO();
        BeanUtils.copyProperties(careWelfareMerchantStreetRelUpdateRequest,careWelfareMerchantStreetRelDO);
        
        return careWelfareMerchantStreetRelDO;
    }

    
    public static CareWelfareMerchantStreetRelDO convertRequestIO2DO(final CareWelfareMerchantStreetRelInsertRequest careWelfareMerchantStreetRelInsertRequest) {
        final CareWelfareMerchantStreetRelDO careWelfareMerchantStreetRelDO = new CareWelfareMerchantStreetRelDO();
        BeanUtils.copyProperties(careWelfareMerchantStreetRelInsertRequest,careWelfareMerchantStreetRelDO);
        return careWelfareMerchantStreetRelDO;
    }

    
    public static List<CareWelfareMerchantStreetRelDTO> convertResponseDOList2DTOList(final List<CareWelfareMerchantStreetRelDO> careWelfareMerchantStreetRelDOList){
        return careWelfareMerchantStreetRelConverter.convertGenericResponseDOList2DTOList(careWelfareMerchantStreetRelDOList);
    }

    
    public static CareWelfareMerchantStreetRelDTO convertResponseDO2DTO(final CareWelfareMerchantStreetRelDO careWelfareMerchantStreetRelDO){
        return careWelfareMerchantStreetRelConverter.convertGenericResponseDO2DTO(careWelfareMerchantStreetRelDO);
    }

    
    @Override
    protected CareWelfareMerchantStreetRelDTO doConvertResponseDO2DTO(CareWelfareMerchantStreetRelDO careWelfareMerchantStreetRelDO) {
        final CareWelfareMerchantStreetRelDTO careWelfareMerchantStreetRelDTO = new CareWelfareMerchantStreetRelDTO();
        try {
            BeanUtils.copyProperties(careWelfareMerchantStreetRelDO, careWelfareMerchantStreetRelDTO);
        }catch(RuntimeException be){
            
            return null;
        }
        return careWelfareMerchantStreetRelDTO;
    }

}
